package util;


import org.junit.Test;
import org.slf4j.Logger;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.util.Assert;

import java.util.Arrays;
import java.util.List;
import java.util.Random;

@SpringBootTest
class SpringDemoApplicationTests {
    Logger USER = LoggerUtils.logger(LogFileName.USER);

    @Test
    void contextLoads() {
    }

    @Test
    public void testLog() {
        int size = List.of(1, 2, 0, 3, 4, 1, 2, 0, 3, 4, 1, 2, 0, 3, 4).size();
        System.out.println(size);
        Assert.isTrue((size==15),"大量初始化成功");
        //USER.info(String.valueOf(size));
        /*int[] test = {1, 2, 0, 3, 4};
        Arrays.stream(test).filter(v -> v > 0).limit(3).forEach(v -> USER.info(String.valueOf(v)));*/
        //USER.info("结果为==>{}", num);
    }

    @Test
    public void testStream() {
        Random random = new Random();
        long count = random.ints().map(v -> {
            USER.info(String.valueOf(v));
            return v;
        }).limit(10).count();
        Assert.isTrue((count == 10), "返回正确");

    }
}